<!DOCTYPE html>
<html>
<head>
  <title>学生信息查询</title>
  <meta charset="UTF-8">
  <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>
<body>
<h2>学生信息查询</h2>
<table border="1">
  <thead>
  <tr>
    <th>ID</th>
    <th>姓名</th>
    <th>学号</th>
  </tr>
  </thead>
  <tbody id="studentTable">
  </tbody>
</table>
<script>
  $(function() {
    $.ajax({
      url: "/api/students",
      type: "GET",
      dataType: "json",
      success: function(data) {
        if (data) {
          var studentTable = $("#studentTable");
          $.each(data, function(index, student) {
            studentTable.append("<tr><td>" + student.id + "</td><td>" + student.name + "</td><td>" + student.number + "</td></tr>");
          });
        }
      },
      error: function(xhr, status, error) {
        alert("查询学生信息失败：" + error);
      }
    });
  });
</script>
</body>
</html>

